/*
 * 爱组搭，低代码组件化开发平台
 * ------------------------------------------
 * 受知识产权保护，请勿删除版权申明，开发平台不允许做非法网站，后果自负
 */
package com.aizuda.boot.modules.system.entity;

import com.aizuda.core.bean.BaseEntity;
import com.aizuda.core.validation.Create;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.PositiveOrZero;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 部门
 *
 * @author 青苗
 * @since 2021-11-07
 */
@Data
@TableName("sys_department")
@Schema(name = "SysDepartment", description = "部门")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SysDepartment extends BaseEntity {

    @Schema(description = "父ID")
    @NotNull(groups = Create.class)
    @PositiveOrZero
    private Long pid;

    @Schema(description = "名称")
    @NotBlank(groups = Create.class)
    @Size(max = 30)
    @TableField(condition = SqlCondition.LIKE)
    private String name;

    @Schema(description = "编码")
    @NotBlank(groups = Create.class)
    @Size(max = 30)
    @TableField(condition = SqlCondition.LIKE)
    private String code;

    @Schema(description = "排序")
    @PositiveOrZero
    @OrderBy
    private Integer sort;

    @Schema(description = "备注")
    @Size(max = 255)
    @TableField(condition = SqlCondition.LIKE)
    private String remark;

    @Schema(description = "状态 0、禁用 1、正常")
    @PositiveOrZero
    private Integer status;

    @Schema(description = "主管ID")
    @PositiveOrZero
    private Long headId;

    @Schema(description = "主管名称")
    private String headName;

    @Schema(description = "删除标识 0、否 1、是")
    @TableLogic(value = "0", delval = "1")
    @TableField("deleted")
    private Integer deleted;

    @Schema(description = "飞书租户标识")
    @TableField(value = "tenant_key")
    private String tenantKey;

    @Schema(description = "飞书平台唯一部门ID")
    @TableField(value = "open_department_id")
    private String openDepartmentId;

    @Schema(description = "系统/独立租户标识(0:否 1:是)")
    @TableField(value = "independent_flag")
    private Integer independentFlag;

    @Schema(description = "系统/独立租户key")
    @TableField(value = "sys_tenant_key", condition = SqlCondition.EQUAL)
    private String sysTenantKey;


}
